﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title></title>
	<link href="Themes/Default/Form.css" rel="stylesheet" type="text/css" />
	<link href="Themes/Default/CommonCtrl.css" rel="stylesheet" type="text/css" />
	<link href="Themes/Default/TreeView.css" rel="stylesheet" type="text/css" />
	<link href="Themes/Default/Control.css" rel="stylesheet" type="text/css" />

	<script src="Core/Common.js" type="text/javascript"></script>

	<script src="Core/Extent.js" type="text/javascript"></script>

	<script src="Core/Sub.js" type="text/javascript"></script>

	<script src="UI/CommonCtrl.js" type="text/javascript"></script>

	<script src="UI/TreeView.js" type="text/javascript"></script>

	<script src="UI/Control.js" type="text/javascript"></script>

	<script src="UI/AccountTree.js" type="text/javascript"></script>

	<script language="javascript" type="text/javascript">

		var usertree_ = null;

		function init()
		{
			Core.UI.PagePanel.Create('');
			var page_ctrl = new Core.UI.TabControl(
				Core.UI.PagePanel,
				{
					ID: "tabctrl",
					Css: "tabctrl ct_tab",
					Margin: 1,
					Tabs: [
						{
							ID: "TAB0", MinWidth: 100, Text: "所有人员", IsSelected: true,
							Controls: [
								{
									ID: "bottompanel", Css: "bottompanel", Margin: [0, 6, 6, 6], Height: 32, DockStyle: Core.UI.DockStyle.Bottom,
									Controls: [
										{ ID: "btnok_container", Css: "ct_custom_default_button", Width: 100, DockStyle: Core.UI.DockStyle.Right }
									]
								},
								{ ID: "usertree_conteiner", Css: "ct_treeview", Margin: 6, DockStyle: Core.UI.DockStyle.Fill }
							]
						}
					],
					DockStyle: Core.UI.DockStyle.Fill
				}
			);

			var usertree_conf = {};
			usertree_conf.DSConfig = {
				ShowUser: true,
				ShowGroup: false,
				ShowUserCheckBox: true,
				ShowUserState: true
			};

			usertree_ = new Core.UI.AccountTree(page_ctrl.GetTabPanelContainer("TAB0", "usertree_conteiner"), usertree_conf);
			usertree_.RefreshTree(
				function()
				{
					usertree_.Select(Core.EmptyCallback, "/COMPANY");
				},
				true
			);

			var btnok = new Core.UI.Button(page_ctrl.GetTabPanelContainer("TAB0", "bottompanel/btnok_container"), { Text: "创建多人会话", TabIndex: 1 });
			btnok.OnClick.Attach(
				function()
				{
					var ids = [];
					var checkedNodes = usertree_.GetCheckedNodes();
					for (var i in checkedNodes)
					{
						ids.push(checkedNodes[i].GetTag().Data.ID);
					}

					var data = {
						Action: "CreateTempGroup",
						Members: ids.join(",")
					};
					CurrentWindow.Waiting("正在创建临时会话...");
					Core.SendCommand(
						function(ret)
						{
							Core.AccountData.UpdateTempGroupInfo(ret.GroupInfo);
							Core.AccountData.FireDataChangedEvent("AddTempGroup", { GroupInfo: ret.GroupInfo });
							Core.Session.GetGlobal("ChatService").Open(ret.GroupInfo.ID, false);
							setTimeout(function() { CurrentWindow.Close(); }, 10);
						},
						function(ex)
						{
							callback(false, ex);
						},
						Core.Utility.RenderJson(data), "Core.Web Common_CH", false
					);
				}
			);
		}
	</script>

</head>
<body>
</body>
</html>
